package com.mdd.front.service.order;


import com.github.binarywang.wxpay.exception.WxPayException;
import com.mdd.common.core.PageResult;
import com.mdd.common.dto.result.OrderPageResultDto;
import com.mdd.common.entity.order.Order;
import com.mdd.front.validate.PageParam;
import com.mdd.front.validate.order.OrderParam;
import com.mdd.front.vo.goods.OrderGoodsDetailVo;
import com.mdd.front.vo.order.OrderDetailVo;
import com.mdd.front.vo.order.OrderListVo;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单服务接口类
 */
public interface IOrderService {

    /**
     * 订单列表
     *
     * @param pageParam 分页参数
     * @param params    搜索参数
     * @return PageResult<OrderVo>
     */
    PageResult<OrderListVo> list(PageParam pageParam, Map<String, String> params);

    PageResult<OrderListVo> listSalesman(PageParam pageParam, Map<String, Object> params);

    /**
     * 订单详情
     *
     * @param id 主键ID
     * @return Order
     */
    OrderDetailVo detail(Integer id);

    /**
     * 订单新增
     *
     * @param orderParam 参数
     */
    Order add(OrderParam orderParam);

    void cancelOrder(Long id, Long userId, Integer source) throws Exception;

    void cancelOrder(Long id, Long userId, Integer source, String returnNumber) throws Exception;

    void cancelOrder(String sn, Long userId, Integer source) throws Exception;

    void confirmGoods(Long id, Long userId);

    void verificationOrder(Long id, Integer userId, String code);

    PageResult<OrderListVo> staffOrderList(PageParam pageParam, Map<String, String> params);

    //void cancelPay(Long id) throws Exception;

    List<Order> getNoPayOrderByDuration(int minutes);

    void checkOrderStatus(Long id) throws Exception;

    List<Order> listFinishByUserId(Long userId);

    Order getById(Long orderId, Integer userId);

    void del(Long id);

    Order updateSn(Integer orderId, String payChannel);

    boolean updateOrderStatusToPaid(String outTradeNo, String transactionId) throws WxPayException;

    boolean updateOrderStatusToICBC(Map<String, String> result) throws Exception;

    OrderGoodsDetailVo initOrder(Long userId, Integer goodsNum, Long specificationId, Integer isBuy);

    PageResult<OrderPageResultDto> listWaitComment(PageParam pageParam, Map<String, String> params);

    Order payStatus(Long id) throws Exception;

    List<Order> getNoStaffByDuration(int time);

    Order getBySn(String outTradeNo);

    void updateOrderPayWay(Integer orderId, Integer payWay);

    boolean updateAliPayOrderStatusToPaid(String outTradeNo, String transactionId);

    String callUserPhone(Map<String, String> map) throws ExecutionException, InterruptedException;

    List<OrderListVo> getBuyOrder(Long orderId, Integer userId);

    /**
     * @param adminId 当前用户
     * @param goodsId 服务id
     * @return 返回订单id和图片地址
     */
    Map<String, String> createBuyOrder(Integer adminId, Integer goodsId);

    Order update(OrderParam orderParam);
}
